package com.sun.java.basicio.Serial;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class TestClass {

	public static void main(String[] args){
		
		
	}
	
	public static void Seriable() throws IOException{
		
		FileOutputStream out = null;
		ObjectOutputStream objOut = null;		
		
		try {
			out = new FileOutputStream("Z:\\file.out");
			objOut = new ObjectOutputStream(out);
			TestClassSerial obj = new TestClassSerial();
			objOut.writeObject(obj);
			objOut.flush();			
			
		} finally {
			// TODO: handle exception
			if(objOut != null)
				objOut.close();
			
			if(out != null)
				out.close();
		}
		
		
	}
	
	public static void DeSeriable() throws IOException{
		
		FileInputStream fs = null;
		ObjectInputStream objIn = null;		
		
		try {
			fs = new FileInputStream("Z:\\file.out");
			objIn = new ObjectInputStream(fs);
			try {
				TestClassSerial obj = (TestClassSerial) objIn.readObject();
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		
			
		} finally {
			// TODO: handle exception
			if(objIn != null)
				objIn.close();
			
			if(fs != null)
				fs.close();
		}
	}
}
